<template>
  <mask-module
    ref="mask"
    class="flex-h flex-vc flex-hc"
    :isClickBgToHide="false"
  >
    <div class="confirm-box-wrapper">
      <!-- 标题部分 -->
      <div class="confirm-box-title">{{title}}</div>
      <!-- 描述部分 -->
      <p class="confirm-box-message">{{message}}</p>
      <!-- 按钮部分 -->
      <!-- 有两个按钮 -->
      <div
        class="flex-h xb_border eee confirm-box-btns"
        v-if="cancelText"
      >
        <button
          class="flex1 confirm-box-false-btn"
          @click="clickCancel"
        >{{cancelText}}</button>
        <button
          class="flex1 baseBgColorWithActive confirm-box-true-btn"
          @click="clickConfirm"
        >{{confirmText}}</button>
      </div>
      <!-- 只有一个按钮 -->
      <button
        v-else
        class="baseBgColorWithActive confirm-box-one-true-btn"
        @click="clickConfirm"
      >{{confirmText}}</button>
    </div>
  </mask-module>
</template>

<script>
// import { MaskModule } from 'vue-xb-ui-depot'
import AnimatedDialog from '@/components/animateddialog/AnimatedDialog'
export default {
  components: {
    // 'mask-module': MaskModule
    'mask-module': AnimatedDialog
  },
  props: {
    callback: {
      type: Function,
      default: null
    },
    title: {
      type: String,
      default: ''
    },
    message: {
      type: String,
      default: ''
    },
    confirmText: {
      type: String,
      default: '确定'
    },
    cancelText: {
      type: String,
      default: '取消'
    }
  },
  // data() {
  //   return {
  // callback: null,
  // title: '',
  // message: '',
  // confirmText: '确定',
  // cancelText: '取消'
  //   }
  // },
  computed: {
    mask() {
      return this.$refs.mask
    }
  },
  mounted() {

  },
  methods: {
    clickConfirm() {
      this.mask.hide()
      this.callback && this.callback(true)
    },
    clickCancel() {
      this.mask.hide()
      this.callback && this.callback(false)
    }
  }
}
</script>

<style>
.mask-module-wrapper {
  background-color: rgba(0, 0, 0, 0.5) !important;
}
.confirm-box-wrapper {
  width: 560px;
  background-color: #ffffff;
  color: #333333;
  border-radius: 8px;
  overflow: hidden;
}
.confirm-box-title {
  text-align: center;
  padding: 30px;
  font-size: 40px; /*px*/
}
.confirm-box-message {
  min-height: 90px;
  line-height: 1.4;
  padding: 0 30px;
  font-size: 32px; /*px*/
}
.confirm-box-btns {
  margin-top: 40px;
  height: 100px;
}
.confirm-box-btns > button {
  height: 100%;
  border: none;
  font-size: 32px; /*px*/
}
.confirm-box-false-btn {
  background: none;
}
.confirm-box-true-btn {
  color: #ffffff;
  border-radius: 0 0 8px 0;
}
/* 单按钮 */
.confirm-box-one-true-btn {
  width: 300px;
  height: 80px;
  margin: 30px 130px;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 32px; /*px*/
}
</style>
